#include "oxford-task-view.h"

using namespace Oxford;

TaskView::TaskView() : QObject()
{
}

void TaskView::draw(QWidget* parent, Core::ITask* task)
{
    _task = task;
    _parent = parent;

    question = new QLabel(task->_definition, parent);

    answerButton = new QPushButton(parent, "Answer");
    QObject::connect(answerButton, SIGNAL(clicked()), this, SLOT(answerButtonClicked()));

    userAnswer = new QLineEdit(parent);

    layout = new QFormLayout(parent);
    layout->addRow("Rule:", question);
    layout->addRow("Answer:", userAnswer);
    layout->addRow("", answerButton);
}

void Oxford::TaskView::answerButtonClicked()
{
    _task



    question.deleteLater();
    answerButton->deleteLater();
    userAnswer->deleteLater();
    layout->deleteLater();

    emit finished();
}
